<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration {
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up() {
		Schema::create('users', function (Blueprint $table) {
			// $table->engine = 'InnoDB';
			$table->increments('id');
			$table->string('name', 36)->unique()->comment('用户名称')->index();
			$table->string('password')->comment('密码');
			$table->string('nick_name', 36)->nullable()->comment('用户名称');
			$table->string('email')->unique()->comment('邮箱')->index();
			$table->text('avatar')->nullable()->comment('头像');
			$table->string('confirm_code', 64)->comment('确认码');
			$table->boolean('status')->default(true)->comment('是否使用')->index();
			$table->boolean('is_admin')->default(false)->comment('是否管理员');
			$table->string('website')->nullable()->comment('个人网站');
			$table->string('github')->nullable()->comment('github');
			$table->string('weibo')->nullable()->comment('weibo');
			$table->string('description')->nullable()->comment('个人简介');
			$table->integer('last_time')->default(0)->comment('最后登录时间');
			$table->boolean('email_notify_enabled')->default(true)->index()->comment('是否开启邮件通知');
			$table->rememberToken();
			$table->timestamps();
			$table->softDeletes();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down() {
		Schema::dropIfExists('users');
	}
}
